/*
 * @Author: your name
 * @Date: 2022-03-30 14:29:45
 * @LastEditTime: 2022-04-08 09:53:19
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \四阶段项目\erp-management-system\src\views\other\WorkReport\Modal.jsx
 */
import React, { useState } from 'react';
import { Modal, Button, Radio } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import './work.css';
const ModalInfo = (props) => {
    const { getPerson } = props
    // console.log(props);
    const [isModalVisible, setIsModalVisible] = useState(false);
    const [value, setValue] = React.useState();

    const showModal = () => {
        setIsModalVisible(true);
    };

    const handleOk = () => {
        setIsModalVisible(false);
        // console.log(value);
        //传值给父组件
        getPerson(value)
    };

    const handleCancel = () => {
        setIsModalVisible(false);
    };

    const onChange = e => {
        // console.log('radio checked', e.target.value);
        setValue(e.target.value);
    };
    return (
        <>
            <Button type="primary" icon={<PlusOutlined />} onClick={showModal}>
                选择接受的人
            </Button>
            <Modal title="快速选择" visible={isModalVisible} onOk={handleOk} onCancel={handleCancel} okText="确认"
                cancelText="取消">
                <p>选择收件人</p>
                <div className='recipients'>
                    <span className='choose-pserson'>总经办</span>
                    <Radio.Group onChange={onChange} value={value}>
                        <Radio value='yyqx'>yyqx</Radio>
                        <Radio value='dlrb'>dlrb</Radio>
                    </Radio.Group>
                </div>
                <div className='recipients'>
                    <span className='choose-pserson'>财务部</span>
                    <Radio.Group onChange={onChange} value={value}>
                        <Radio value='wsx'>wsx</Radio>
                        <Radio value='D.O'>D.O</Radio>
                    </Radio.Group>
                </div>
                <div className='recipients'>
                    <span className='choose-pserson'>业务一部</span>
                    <Radio.Group onChange={onChange} value={value}>
                        <Radio value='5'>A</Radio>
                        <Radio value='6'>B</Radio>
                    </Radio.Group>
                </div>
                <div className='recipients'>
                    <span className='choose-pserson'>业务二部</span>
                </div>
            </Modal>
        </>
    );
}

export default ModalInfo;
